package jay.home.bet.web.struts;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import jay.home.bet.domain.Item;
import jay.home.bet.domain.Order;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 * 当前未结算的用户注单.<br/>
 * @author Administrator
 */
public class UserOrderStatus extends BaseAction
{
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		String username = request.getRemoteUser();
		List<Order> orders = getOrderService().getUserAliveOrders(username);
		for(Order order : orders)
			for(Item item : order.getItems())
				item.setEvent(getOddsService().getEvent(item.getEventid()));
		request.setAttribute("orders", orders);
		return mapping.findForward("SUCCESS");
	}
}
